<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
use think\facade\Route;

Route::get('think', function () {
    return 'hello,ThinkPHP6!';
});
/**
 * 商品
 */
//商品列表
Route::get('list', 'Goods/list');
//主页
Route::get('home', 'Goods/home');
//商品详情
Route::get('detail/:id', 'Goods/detail');
//获取动态的价格
Route::post('price', 'Goods/price')->allowCrossDomain();



/**
 * 购物车
 */
//成功加入购物车界面
Route::post('success_cart', 'Goods/success_cart')->middleware(\app\home\middleware\Login::class);
//购物车界面
Route::get('cart', 'Goods/cart')->middleware(\app\home\middleware\Login::class);
//购物车删除
Route::get('cartDel', 'Goods/cartDel')->middleware(\app\home\middleware\Login::class);
//改变购物车选中物品的状态
Route::post('status', 'Goods/status')->middleware(\app\home\middleware\Login::class);
//改变购物车某一条的商品数量
Route::post('number', 'Goods/number')->middleware(\app\home\middleware\Login::class);
//跳到结算页面
Route::get('getOrderInfo', 'Goods/getOrderInfo')->middleware(\app\home\middleware\Login::class);
//提交订单
Route::get('pay', 'Goods/pay')->middleware(\app\home\middleware\Login::class);
//猜你喜欢的加入购物车
Route::get('hotadd', 'Goods/hotadd')->middleware(\app\home\middleware\Login::class);

/**
 * 登录
 */
//登录页面
Route::get('logins', 'Login/login')->allowCrossDomain();
//登录验证
Route::post('loginPro', 'Login/loginPro')->allowCrossDomain();
//退出登录
Route::get('loginOut', 'Login/loginOut')->allowCrossDomain();
//注册界面
Route::get('register', 'Login/register')->allowCrossDomain();
//生成验证码
Route::get('code', 'Login/code')->allowCrossDomain()->middleware(\think\middleware\Throttle::class, [
    'visit_rate' => '5/m',
    'key' => '__CONTROLLER__/__ACTION__/__IP__',
]);
//用户注册添加
Route::post('userAdd', 'Login/userAdd')->allowCrossDomain()->middleware(\app\home\middleware\CheckLogin::class);
//第三方登录回调
Route::get('/login/qqcallback', 'Login/qqcallback')->allowCrossDomain();




//上传图片选择添加文字水印或图片水印
Route::post('pic', 'Login/pic')->allowCrossDomain();
//展示界面



//七牛云上传
Route::any('qiniu', 'Login/qiniu')->allowCrossDomain();//这里千万注意了，有个请求方式的配置问题，默认只有get，head，得去config配置


/**
 *回收站测试
 */
Route::get('del', 'Login/del')->allowCrossDomain();
Route::get('trash', 'Login/trash')->allowCrossDomain();
Route::get('restore', 'Login/restore')->allowCrossDomain();


/**
 * 支付宝
 */
//去支付
Route::get('alipay', 'Goods/alipay')->allowCrossDomain();
//支付宝同步回调地址
Route::get('payOk', 'Goods/payOk')->allowCrossDomain();
//支付宝异步
Route::post('SyncNotify', 'Goods/SyncNotify')->allowCrossDomain();
//网络异常
Route::get('connect', 'Goods/connect')->allowCrossDomain();


/**
 * 鉴权测试
 */

Route::get('token', 'Index/token')->allowCrossDomain();
Route::get('front', 'Index/front')->allowCrossDomain();
Route::post('test', 'Index/test')->allowCrossDomain()->middleware(\app\common\middleware\outh::class);//服务层相当于中间件

